package jmine.tec.web.wicket.component;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

/**
 * Checkbox em formato de Panel para poder adicionar em outros lugares
 * 
 * @author takeshi
 */
public abstract class InlinedAjaxCheckBox extends Panel {

    /**
     * C'tor
     * 
     * @param id String
     * @param model IModel
     */
    public InlinedAjaxCheckBox(String id, IModel<Boolean> model) {
        super(id);
        this.add(new AjaxCheckBox("checkBox", model) {

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                InlinedAjaxCheckBox.this.onUpdate(target);
            }
        });
    }

    /**
     * Metodo ajax invocado
     * 
     * @param target target
     */
    protected abstract void onUpdate(AjaxRequestTarget target);
}
